//
//  ZBMoBanFiveViewController.m
//  MoBan
//
//  Created by apple on 16/7/12.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ZBMoBanFiveViewController.h"
#import "ZBMoBanFiveScrollview.h"
#import "ZBMoBanFiveHeadView.h"
@interface ZBMoBanFiveViewController ()<ZBMoBanFiveScrollviewDatasouce,UITableViewDataSource,UITableViewDelegate,ZBMoBanFiveHeadViewDeleget,ZBMoBanFiveScrollviewDeleget>
@property(nonatomic,strong)ZBMoBanFiveScrollview *scrollview;
@property(nonatomic,strong)NSMutableArray *array;
@property(nonatomic,strong)UITableView *tableview;
@end

@implementation ZBMoBanFiveViewController
-(UITableView *)tableview
{
    if (!_tableview) {
        _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KscrW, KscrH-KBar1)];
        _tableview.dataSource = self;
        _tableview.delegate = self;
        _tableview.tableHeaderView = self.scrollview;
    }
    return _tableview;

}
-(NSMutableArray *)array
{
    if (!_array) {
        _array = [NSMutableArray array];
    }
    return _array;
}
-(ZBMoBanFiveScrollview *)scrollview
{
    if (!_scrollview) {
        _scrollview = [[ZBMoBanFiveScrollview alloc]init];
        _scrollview.frame = CGRectMake(0, 0, KscrW, 120*Kscr);
        _scrollview.datasouce = self;
        _scrollview.deleget = self;
    }
    return _scrollview;

}
- (void)viewDidLoad {
    [super viewDidLoad];
    NSArray *array0=@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"0",@"11"];
    NSArray *array1=@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"0",@"11"];
    
    [self.array addObject:array0];
    [self.array addObject:array1];
    
    [self.view addSubview:self.tableview];
    [self.scrollview reloadDta];
    
    // Do any additional setup after loading the view.
}

-(NSMutableArray *)ZBDatasouceFromArray
{
    return self.array[0];

}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;

}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 50*Kscr;

}
- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    ZBMoBanFiveHeadView *headview = [[ZBMoBanFiveHeadView alloc]init];
    headview.frame = CGRectMake(0, 0, KscrW, 50*Kscr);
    headview.deleget = self;

    return headview;

}
/**
 headview的代理
 */
-(void)ZBSegmentBtnClic:(NSInteger )inter
{
    [ZBProssHud showsuccessFrom:self.view with:[NSString stringWithFormat:@"点击%ld",inter]];
    
}
-(void)ZBDidSelectde:(NSInteger)inter
{
[ZBProssHud showsuccessFrom:self.view with:[NSString stringWithFormat:@"点击%ld",inter]];

}
@end
